<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
 ?>

<?= Html::cssFile('./css/course/bootstrap.css')?>
<?= Html::cssFile('./css/course/common.css')?>
<?= Html::cssFile('./css/course/bootstrap-extends.css')?>
<?= Html::cssFile('./css/course/class-default.css')?>
<?= Html::cssFile('./css/course/web.css')?>
<?= Html::cssFile('./css/course/member.css')?>
<?= Html::cssFile('./css/course/font-awesome.min.css')?>
<?= Html::cssFile('./assets/date/bootstrap-datetimepicker.min.css')?>


<div id="content-container" class="container" style="margin-top: 50px;">
<div class="row row-12">
  <div class="col-md-12">
    <div class="panel panel-default  course-header" style="margin-top:40px;">
      <div class="panel-body clearfix">
        <a href="http://localhost/eudsoho/web/app.php/course/2">
            <?php if($course['course_thumb']){?>
                <img class="picture" src="<?php echo 'http://files.bwphp.com/file/image/show/110/60?path='.$course['course_thumb']?>">
            <?php }else{?>
            <img class="picture" src="./css/course/coursePicture">
            <?php }?>
        </a>

        <h1 class="title"><a href="http://localhost/eudsoho/web/app.php/course/2"><?php echo $course['course_name']; ?></a>
                      <span class="label label-warning ">
                      <?php if ($course['status'] == 0) {
                        echo '未发布';
                      }elseif ($course['status'] == 1) {
                        echo "已发布";
                      }elseif ($course['status'] == 2) {
                        echo "已关闭";
                      } ?></span>
                  </h1>
        <div class="teachers">教师：
             <a href="#" data-toggle="modal" data-url="/eudsoho/web/app.php/course/2/teacher/1"><?php echo $course['teacher']['teacher_name']  ?></a>
        </div>

       <!--  <div class="toolbar hidden-xs hidden-lt-ie8">
           <div class="btn-group">
             <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">预览 <span class="caret"></span></button>
             <ul class="dropdown-menu pull-right">
                 <li><a href="#" target="_blank">作为 已购买用户</a></li>
                 <li><a href="#" target="_blank">作为 未购买用户</a></li>
             </ul>
           </div>
               <div class="btn-group">
                   <button class="btn btn-success btn-sm course-publish-btn" data-url="/eudsoho/web/app.php/course/2/manage/publish">发布课程</button>
               </div>

                 </div> -->
      </div>
    </div>
  </div>
</div>

<div class="row">
  <div class="col-md-3">
                <div class="panel panel-default">
        <div class="panel-body">
          <div class="list-group-panel">
			<?php echo $this->render('_leftnav') ?>
      </div>
      </div>
  <div class="col-md-9">

<div class="panel panel-default panel-col lesson-manage-panel">
	<div class="panel-heading">
		<div class="pull-right">

			<!-- <button class="btn btn-info btn-sm" id="lesson-create-btn" data-toggle="modal" data-target="#modal_keshi" data-backdrop="static" data-keyboard="false" data-url="/eudsoho/web/app.php/course/2/manage/lesson/create"><i class="glyphicon glyphicon-plus"></i> 课时</button> -->

			<button class="btn btn-info btn-sm" id="lesson-create-btn" data-toggle="modal" data-target="#modal_shijuan" data-backdrop="static" data-keyboard="false" data-url="/eudsoho/web/app.php/course/2/manage/lesson/create/testpaper"><i class="glyphicon glyphicon-plus"></i> 试卷</button>

			<div class="btn-group">
			  <button type="button" class="btn btn-sm btn-success dropdown-toggle" data-toggle="dropdown">
			    <i class="glyphicon glyphicon-plus" data-toggle="modal" data-target="#modal"></i> 章</span>
			  </button>
			   <ul class="dropdown-menu" role="menu">
          <li>
            <a href="http://localhost/eudsoho/web/app.php/course/2/manage/lesson#" id="chapter-create-btn" data-toggle="modal" data-target="#modal" data-backdrop="static" data-keyboard="false" data-url="/eudsoho/web/app.php/course/2/manage/chapter/create"><i class="glyphicon glyphicon-plus"></i> 添加 章</a>
          </li>

        </ul>
			</div>
		</div>
		课时管理
	</div>

<?php if (empty($sections)) {?>
   <div class="empty">暂无课时内容！</div>
 <?php } ?>

	<div class="panel-body">
    <ul class="lesson-list sortable-list" id="course-item-list" data-sort-url="/eudsoho/web/app.php/course/2/manage/lesson/sort">

   <?php foreach ($sections as $k => $section) {?>

    <li class="item-chapter  clearfix" id="chapter-4" style="word-break: break-all;">
  <div class="item-content">第 <span class="number"><?php echo $section['section_num'] ?></span> 章： <?php echo $section['section_name'] ?></div>
  <div class="item-actions prs">
    <div class="btn-group">
    <button class="btn btn-link dropdown-toggle" title="" data-toggle="dropdown" data-original-title="添加"><i class="glyphicon glyphicon-plus-sign"></i></button>
            <ul class="dropdown-menu" role="menu">
                <li>
                    <a href="#" id="chapter-create-btn" class="add_joint" data-toggle="modal" data-target="#modal_jie" name="<?php echo $section['section_id']; ?>" data-backdrop="static" data-keyboard="false" data-url="/eudsoho/web/app.php/course/2/manage/chapter/create?type=unit&amp;parentId=chapter-4"><i class="glyphicon glyphicon-plus"></i> 添加 节 </a>
                </li>
                <li>
                    <a href="#" id="chapter-create-btn" data-toggle="modal" data-target="#" data-backdrop="static" data-keyboard="false" data-url="/eudsoho/web/app.php/course/2/manage/lesson/create/testpaper?parentId=chapter-4"><i class="glyphicon glyphicon-plus"></i> 添加 试卷 </a>
                </li>
            </ul>

    </div>

    <button class="btn btn-link edit_section" title="" section_id="<?php echo $section['section_id'] ?>" section_name="<?php echo $section['section_name'] ?>"  data-toggle="modal" data-target="#modal" data-keyboard="false" data-url="/eudsoho/web/app.php/course/2/manage/chapter/4/edit" data-original-title="编辑"><i class="glyphicon glyphicon-edit"></i></button>

    <button class="btn btn-link delete-chapter-btn" title="" data-url="/eudsoho/web/app.php/course/2/manage/chapter/4/delete" data-chapter="章" data-part="节" data-original-title="删除"><i class="glyphicon glyphicon-trash"></i></button>

    </div>
</li>
 <?php if (!empty($section['joint'])) {?>
  <?php foreach ($section['joint'] as $key => $joint) { ?>


    <li class="item-chapter item-chapter-unit clearfix" id="chapter-5" style="word-break: break-all;">
  <div class="item-content">第 <span class="number"><?php echo $joint['joint_num']; ?></span> 节： <?php echo $joint['joint_name']; ?></div>
  <div class="item-actions prs">
    <div class="btn-group">
    <button class="btn btn-link dropdown-toggle" title="" data-toggle="dropdown" data-original-title="添加"><i class="glyphicon glyphicon-plus-sign"></i></button>
          <ul class="dropdown-menu" role="menu">
          <li>
            <a href="#" id="chapter-create-btn" class="add_period" data-toggle="modal" name="<?php echo $joint['joint_id']; ?>" data-target="#modal_period" data-backdrop="static" data-keyboard="false" data-url="/eudsoho/web/app.php/course/2/manage/lesson/create?parentId=chapter-5"><i class="glyphicon glyphicon-plus"></i>  添加 课时  </a>
          </li>
                    <li>
            <a href="#" id="chapter-create-btn" data-toggle="modal" data-target="" data-backdrop="static" data-keyboard="false" data-url="/eudsoho/web/app.php/course/2/manage/lesson/create/testpaper?parentId=chapter-5"><i class="glyphicon glyphicon-plus"></i> 添加 试卷 </a>
          </li>
                </ul>

    </div>

    <button class="btn btn-link edit_joint" joint_name="<?php echo $joint['joint_name'] ?>" joint_id="<?php echo $joint['joint_id'] ?>" title="" data-toggle="modal" data-target="#modal_jie" data-keyboard="false" data-url="/eudsoho/web/app.php/course/2/manage/chapter/5/edit" data-original-title="编辑"><i class="glyphicon glyphicon-edit"></i></button>

    <button class="btn btn-link delete-chapter-btn" title="" data-url="/eudsoho/web/app.php/course/2/manage/chapter/5/delete" data-chapter="章" data-part="节" data-original-title="删除"><i class="glyphicon glyphicon-trash"></i></button>

    </div>
</li>
<?php if (!empty($joint['period'])) {?>
<?php foreach ($joint['period'] as $key => $period) {  ?>
<li class="item-lesson clearfix" id="lesson-2" style="word-break: break-all;">
  <div class="item-line"></div>
  <div class="item-content">
                <i class="fa fa-file-video-o text-success"></i>
              课时 <span class="number"><?php echo $key+1; ?></span>：
         <?php  echo $period['period_name'] ?>

           <span class="text-muted">
             <?php if ($period['movie_url']) {
               echo "时长&nbsp".$period['length_minute'].":".$period['length_second'];
             }else  {
               echo "(暂无视频)";
             } ?>
           </span>
      </div>
  <div class="item-actions">
    <a class="btn btn-link modal_period" data-toggle="modal" joint_id="<?php echo $joint['joint_id'] ?>" period_id="<?php echo $period['period_id'] ?>"  data-target="#modal_period" data-backdrop="static" data-keyboard="false" data-url="/eudsoho/web/app.php/course/2/manage/lesson/2/edit" data-original-title="" title=""><span class="glyphicon glyphicon-edit prs"></span>编辑</a>
          <a class="btn btn-link" href="/eudsoho/web/app.php/course/2/learn?preview=1#lesson/2" target="_blank" data-original-title="" title=""><span class="glyphicon glyphicon-eye-open prs"></span>预览</a>
        <span class="dropdown">
      <a class=" dropdown dropdown-toggle dropdown-more" id="dropdown-more" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-chevron-down" style="top:4px;margin-right:3px" aria-haspopup="true" aria-expanded="false"></span>更多</a>

      <ul class="dropdown-menu pull-right dropdown-menu-more" role="menu" style="margin-top:12px;min-width:144px" aria-labelledby="dLabel">
          <li><a href="javascript:;" data-toggle="modal" data-target="" data-url="/eudsoho/web/app.php/course/2/manage/lesson/2/material"><span class="glyphicon glyphicon-paperclip prs"></span>添加资料</a></li>
          <li class="divider"></li>
          <li class="hidden ">
            <a href="javascript:;" class="publish-lesson-btn" data-url="/eudsoho/web/app.php/course/2/manage/lesson/2/publish"><span class="glyphicon glyphicon-ok-circle prs"></span>发布
            </a>
          </li>
              <li class="">
                <a href="javascript:;" class="unpublish-lesson-btn" data-url="/eudsoho/web/app.php/course/2/manage/lesson/2/unpublish"><span class="glyphicon glyphicon-remove-circle prs"></span>取消发布
                </a>
              </li>
        <li><a href="javascript:;" class="delete-lesson-btn" data-url="/eudsoho/web/app.php/course/2/manage/lesson/2/delete"><span class="glyphicon glyphicon-trash prs"></span>删除</a></li>
      </ul>
    </span>
  </div>
</li>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
</ul>
  </div>


</div>

  </div>
</div>
    </div><!-- /container -->

<!-- 添加/编辑 遮罩层 章 -->
<div id="modal" class="modal" aria-hidden="true" style="display: none;"><div class="modal-dialog ">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
      <h4 class="modal-title edit-section">添加章</h4>
    </div>
    <div class="modal-body">
<?php $form = ActiveForm::begin(['method'=>'post',]);?>
  <div class="row form-group">
    <div class="col-md-3 control-label">
        <label for="chapter-title-field">章标题</label>
    </div>
    <div class="col-md-8 controls">
    <input id="chapter-title-field" type="text" name="section_name" value="" class="form-control section_name" data-widget-cid="widget-5" data-explain="">
    <div class="help-block" style="display:none;"></div></div>
  </div>
    <input type="hidden" class="section_id"   name="section_id" value="">
    <input type="hidden" name="course_id" value="<?php echo $course['course_id'] ?>">
    <input type="hidden" name="type" value="add_section">
</div>
    <div class="modal-footer">
      <button type="button" class="btn btn-link" data-dismiss="modal">取消</button>
      <input type="submit" id="course-chapter-btn" data-submiting-text="正在提交" class="btn btn-primary" data-toggle="form-submit" data-target="#course-chapter-form" data-chapter="章" data-part="节" value="添加">
</div>
<?php ActiveForm::end(); ?>
      </div>
</div></div>

<!-- 添加/编辑 遮罩层 节 -->
<div id="modal_jie" class="modal" aria-hidden="true" style="display: none;"><div class="modal-dialog ">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
      <h4 class="modal-title edit-joint">  添加节</h4>
    </div>
    <div class="modal-body">
<?php $form = ActiveForm::begin(['method'=>'post',]);?>
  <div class="row form-group">
    <div class="col-md-3 control-label">
              <label for="chapter-title-field">节标题</label>
            </div>
    <div class="col-md-8 controls">
    <input id="chapter-title-field" type="text" name="joint_name" value="" class="form-control joint_name" data-widget-cid="widget-5" data-explain=""><div class="help-block" style="display:none;"></div></div>
  </div>
  <input type="hidden" class="joint_id" name="joint_id" value="">
  <input type="hidden" name="type" value="add_joint">
  <input type="hidden" name="course_id" value="<?php echo $course['course_id'] ?>">
  <input type="hidden" id="section_id" name="section_id"  value="">

</div>
     <div class="modal-footer">
     <button type="button" class="btn btn-link" data-dismiss="modal">取消</button>
     <input type="submit" id="course-chapter-btn" data-submiting-text="正在提交"  class="btn btn-primary" data-toggle="form-submit" data-target="#course-chapter-form" data-chapter="章" data-part="节" value="添加">

</div>
<?php ActiveForm::end(); ?>
      </div>
</div></div>
<!-- 添加课时 -->
<div id="modal_period" class="modal" aria-hidden="true" style="display: none;">
<div class="modal-dialog  modal-lg">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
      <h4 class="modal-title">添加课时</h4>
    </div>
    <div class="modal-body">
<!-- <form id="course-lesson-form" data-course-id="2" class="form-horizontal lesson-form lesson-form-video" method="post" data-parentid="" data-create-draft-url="/eudsoho/web/app.php/course/draft/create" action="/eudsoho/web/app.php/course/2/manage/lesson/create" novalidate="novalidate" data-widget-cid="widget-20">  -->
<?php
      $form = ActiveForm::begin([
                                'options' => ['class' => 'form-horizontal lesson-form lesson-form-video',
                                              'id'=>'course-lesson-form'],
                                'method'=>'post',

                                    ]);
                                ?>
  <div class="form-group">
    <div class="col-md-2 control-label"><label>类型</label></div>
    <div class="col-md-9 controls">
      <div class="radios">
        <label><input type="radio"  value="video" checked="checked"> 视频</label>

      </div>
    </div>
  </div>

  <div class="form-group for-text-type for-video-type for-audio-type ">
    <div class="col-md-2 control-label"><label for="lesson-title-field">标题</label></div>
    <div class="col-md-9 controls">
      <div class="row">
        <div class="col-md-10">
          <?= $form->field($period_model, 'period_name')->textInput(['name'=>'period_name'])->label(false) ?>
        </div>
        <div class="col-md-2">
          <div class="checkbox">

          </div>
        </div>
      </div>
    <div class="help-block" style="display:none;"></div></div>
  </div>

  <div <?php if ($course['type_id'] != 11) {
    echo "style=display:none";
  } ?> class="form-group for-text-type for-video-type for-audio-type ">
    <div class="col-md-2 control-label"><label for="lesson-title-field">开课时间</label></div>
    <div class="col-md-9 controls">
      <div class="row">
        <div class="col-md-10">
        <?= Html::input('text', 'open_time',$period_model['open_time'],['class' => 'form-control form-datetime','id' => 'startDateTime','placeholder' => '起始时间']) ?>
        <?= Html::input('text', 'end_time',$period_model['end_time'],['class' => 'form-control form-datetime','id' => 'endDateTime','placeholder' => '结束时间']) ?>
        </div>
        <div class="col-md-2">
          <div class="checkbox">

          </div>
        </div>
      </div>
    <div class="help-block" style="display:none;"></div></div>
  </div>

  <!-- <div class="form-group for-text-type for-video-type for-audio-type ">
    <div class="col-md-2 control-label"><label for="lesson-summary-field">描述</label></div>
    <div class="col-md-9 controls"><textarea class="form-control" id="lesson-summary-field" name="summary"></textarea>

    </div>
  </div> -->

  <div class="form-group for-text-type">



    <div class="col-md-2 control-label"><label for="lesson-content-field" class="style1">内容</label></div>
    <div class="col-md-9 controls">
      <textarea class="form-control" id="lesson-summary-field" ></textarea>
          </div>
  </div>

  <div class="form-group for-video-type for-audio-type  ">
    <div class="col-md-2 control-label for-video-type"><label>视频</label></div>
    <div class="col-md-9 controls">
    <div id="media-choosers">

  <div class="file-chooser" id="video-chooser" style="" data-params-url="/eudsoho/web/app.php/uploadfile/params?storage=local&amp;targetType=courselesson&amp;targetId=2" data-hls-encrypted="1" data-targettype="courselesson" data-targetid="2" data-widget-cid="widget-0">
    <div class="file-chooser-bar" style="display:none;">
      <span data-role="placeholder"></span>
      <button class="btn btn-link btn-sm" type="button" data-role="trigger"><i class="glyphicon glyphicon-edit"></i> 编辑</button>
      <div class="alert alert-warning" data-role="waiting-tip" style="display:none;">正在转换视频格式，转换需要一定的时间，期间将不能播放该视频。<br>转换完成后将以站内消息通知您。</div>
    </div>

    <div class="file-chooser-main">
      <ul class="nav nav-pills nav-pills-mini mbs file-chooser-tabs">
          <li class="active"><a class="file-chooser-uploader-tab file-upload" disabled="disabled" data-toggle="tab">上传视频</a></li>
          <span class="file-upload" style="color:#667CEA">(视频支持MP4和FLV格式)</span>
          <span class="file-edit" id="period_oldname"></span>
          <li class="active"><a class="file-chooser-uploader-tab file-edit" data-toggle="tab">编辑</a></li>

        <?= $form->field($period_model, 'movie_name')->hiddenInput(['id'=>'courseperiod-movie_url','name'=>'movie_name'])->label(false) ?>

      </ul>
        <!--上传视频-->
      <div class="tab-content">
        <div class="tab-pane active" style="position:relative" id="video-chooser-upload-pane">

          <div class="file-chooser-uploader" style="height:390px">
            <!--
            <iframe src="http://admin.bwphp.com/index.php?r=movieup/index" frameborder=0 scrolling=0 height="500px"  width="600px"></iframe>
            -->

                <link rel="stylesheet" type="text/css" href="/webupload/css/webuploader.css" />
    <link rel="stylesheet" type="text/css" href="/webupload/example/image-upload/style.css" />

    <div id="wrapper">
        <div id="container">
            <!--头部，相册选择和格式选择-->
            <div id="uploader">
                <div class="queueList">
                    <div id="dndArea" class="placeholder">
                        <div id="filePicker"></div>
                        <p>一次只能上传一个视频</p>
                    </div>
                </div>
                <div class="statusBar" style="display:none;">
                    <div class="progress">
                        <span class="text">0%</span>
                        <span class="percentage"></span>
                    </div><div class="info"></div>
                    <div class="btns">
                        <div id="filePicker2"></div><div class="uploadBtn">开始上传</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="./webupload/example/image-upload/jquery.js"></script>
    <script type="text/javascript" src="./webupload/dist/webuploader.js"></script>
    <script type="text/javascript" src="./webupload/example/image-upload/upload.js"></script>

        </div>
      </div>
    </div>

  </div>


   <div class="file-chooser" id="flash-chooser" style="display:none;" data-params-url="/eudsoho/web/app.php/uploadfile/params?storage=local&amp;targetType=courselesson&amp;targetId=2&amp;convertor=" data-targettype="courselesson" data-targetid="2" data-widget-cid="widget-16">

  </div>

</div>
    <input id="lesson-media-field" type="hidden"  value="&quot;&quot;" data-widget-cid="widget-22" data-explain="">
    <div class="help-block" style="display:none;"></div></div>
  </div>


  <div class="form-group for-video-type for-audio-type" id="lesson-length-form-group">
      <div class="col-md-2 control-label for-video-type" style="margin-left:10px"><label>视频时长</label></div>
      <div class="hide"><label for="lesson-length-field">视频时长或</label></div>
      <div class="col-md-2 control-label for-audio-type"><label for="lesson-length-field">音频时长</label></div>
    <div class="col-md-9 controls">
      <input class="form-control width-input width-input-small"  type="text" name="length_minute" value="" >分
      <input class="form-control width-input width-input-small"  type="text" name="length_second" value="" >秒

     <!--  <?= $form->field($period_model, 'length_minute')->textInput(['class'=>'form-control width-input width-input-small','id'=>'courseperiod-length_minute','style'=>'float:left'])->label(false) ?>
      <?= $form->field($period_model, 'length_second')->textInput(['class'=>'form-control width-input width-input-small','id'=>'courseperiod-length_second','style'=>'float:left'])->label(false) ?>
      -->

    </div>
  </div>
      <input type="hidden" name="period_id" id="period_id" value="">
      <input type="hidden" name="joint_id" id="joint_id" value="">
      <input type="hidden" name="type" value="add_period">
      <input type="hidden" name="course_id" value="<?php echo $course['course_id'] ?>">

</div>

      <div class="modal-footer">
              <button type="button" class="btn btn-link" data-dismiss="modal" id="cancel-btn">取消</button>
               <?= Html::submitButton('添加', ['class'=>'btn btn-primary']) ?>
          </div>
      </div>
     <?php ActiveForm::end(); ?>
</div>
</div>




<?= Html::jsFile('./assets/date/bootstrap-datetimepicker.min.js')?>
<?= Html::jsFile('./assets/date/bootstrap-datetimepicker.fr.js')?>

<script>
  jQuery(document).ready(function($) {
    $(".add_joint").click(function() {
        var joint_num = $(this).attr('name');
        $("#section_id").val(joint_num);
    });
    $(".add_period").click(function() {
        var period_num = $(this).attr('name');
        $("#joint_id").val(period_num);
    });
    $("#course-lesson-btn").click(function() {
        if ($("#lesson-minute-field").val()&& $("#lesson-second-field").val()) {
          $('#length').hide();
          return true;
        }else{
          $('#length').show();
          return false;
        }
    });

    $(".edit_section").click(function() {
        var section_id    = $(this).attr('section_id');
        var section_name  = $(this).attr('section_name');
        $('.edit-section').text("编辑章");
        $(".section_id").val(section_id);
        $(".section_name").val(section_name);
    });
    $(".edit_joint").click(function() {
        var joint_id    = $(this).attr('joint_id');
        var joint_name  = $(this).attr('joint_name');
        $('.edit-joint').text("编辑节");
        $(".joint_id").val(joint_id);
        $(".joint_name").val(joint_name);
        $("#section_id").remove();
    });
    $(".edit_period").click(function() {
        var period_id = $(this).attr('period_id');

    });
  $('.form-datetime').datetimepicker({
    autoclose: 1,//当选择一个日期之后是否立即关闭此日期时间选择器
    todayHighlight: 1,//如果为true, 高亮当前日期
    startView: 2,//日期时间选择器打开之后首先显示的视图  控制样式  0~4
  });

  $(".modal_period").click(function() {
    var period_id = $(this).attr('period_id');
    var joint_id = $(this).attr('joint_id');

      $.ajax({
        url: "<?php echo Url::to(['course/period']);?>",
        type: 'get',
        dataType: 'json',
        data: {period_id:period_id},
        success: function (msg) {
          console.log(msg)
            if (msg.movie_name) {
              $("#period_oldname").text(msg.movie_name)
              $(".tab-content").hide();
              $(".file-upload").hide();
              $("#period_exist").show();
              $(".file-edit").show();
              $("#courseperiod-movie_url").val(msg.movie_name);

            }else{
              $("#period_oldname").text();
              $(".tab-content").show();
              $(".file-upload").show();
              $(".file-edit").hide();
              //$("#courseperiod-movie_url").val("");
            }
            $("#joint_id").val(joint_id);
            $("#period_id").val(period_id);
            $("#courseperiod-movie_url").val(msg.movie_name);
            $("input[name='period_name']").val(msg.period_name);
            $("input[name='open_time']").val(msg.open_time);
            $("input[name='end_time']").val(msg.end_time);
            $("input[name='length_minute']").val(msg.length_minute);
            $("input[name='length_second']").val(msg.length_second);
        }
      })

    });
  $(".file-edit").click(function() {
      $(".tab-content").show();
      $(".file-upload").show();
      $(".file-edit").hide();
  });
  });
</script>



